﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace WechatModel
{
    public class AccessTokenInfo
    {
        private string _access_token;
        /// <summary>
        /// AccessToken
        /// </summary>
        public string Access_token
        {
            get { return _access_token; }
            set { _access_token = value; }
        }

        private int _expires_in;
        /// <summary>
        /// 有效时间（秒数，一般为7200秒）
        /// </summary>
        public int Expires_in
        {
            get { return _expires_in; }
            set {
                //将有效时间设置的比实际有效时间短200秒
                int countdown = 0;
                if (value > 200)
                    countdown = value - 200;
                else
                    countdown = value;
                _expires_in = countdown; _timeOut = DateTime.Now.AddSeconds(countdown); 
            }
        }

        private DateTime _timeOut;
        /// <summary>
        /// 过期时间
        /// </summary>
        public DateTime TimeOut
        {
            get { return _timeOut; }
            set { _timeOut = value; }
        }
    }
}
